#ifndef WIDGET_H
#define WIDGET_H

#include <QMenu>
#include <QNetworkReply>
#include <QWidget>
#include <qlabel.h>
#include "citycode.h"
#include "day.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    Day day[7];
    QList<QLabel*> mDateList;
    QList<QLabel*> mWeekList;
    QList<QLabel*> mIconList;
    QList<QLabel*> mWeaTypeList;
    QList<QLabel*> mAirqList;
    QList<QLabel*> mFxList;
    QList<QLabel*> mFlList;
    ~Widget();

protected:
    void mousePressEvent(QMouseEvent *event) override;

    void mouseMoveEvent(QMouseEvent *event) override;

    bool eventFilter(QObject* watched, QEvent* event);

public slots:
    void readHttpReply(QNetworkReply* reply);

private slots:

    void on_btnSreach_clicked();

    void on_lineEditCity_returnPressed();

private:
    Ui::Widget *ui;
    QMenu* menuQuit;
    QPoint moffSet;
    QNetworkReply* reply;
    QString strUrl;
    QNetworkAccessManager* mananger;
    QMap<QString,QString> mTypeMap;
    CityCodeUtils cityCodeUtils;

    void parseWeatherJsonData(QByteArray rawData);
    void parseWeatherJsonDataNew(QByteArray rawData);
    void upDataUi();
    void drawTemLineHigh();
    void drawTemLineLow();
};
#endif // WIDGET_H
